package com.cc.controller;


import com.cc.service.GoodService;
import com.dy.cc.Good;
import com.dy.cc.Goods;
import com.kaoshi.common.config.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("good")
public class GoodController {
    @Autowired
    GoodService goodService;


    @RequestMapping("findAll")
    public Result findAll(Good good){
        List<Good> goodList = goodService.findAll(good);
        return Result.ok(goodList);
    }
    @RequestMapping("xiao")
    public Result xiao(Good good){
        List<Good> list = goodService.xiao(good);
        return Result.ok(list);
    }

    @RequestMapping("shang")
    public Result shang(Good good){
        List<Good> list = goodService.shang(good);
        return Result.ok(list);
    }



    @RequestMapping("price")
    public Result price(Good good,Integer a){
        List<Good> list = goodService.price(good,a);
        return Result.ok(list);
    }

    @RequestMapping("sousuo")
    public Result sousuo(@RequestBody Good good){
        List<Good> goodList = goodService.sousuo(good);
        return Result.ok(goodList);
    }



}
